"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.defaultWidgetNameList = exports.widgets = void 0;

require("antd/es/rate/style");

var _rate = _interopRequireDefault(require("antd/es/rate"));

require("antd/es/switch/style");

var _switch = _interopRequireDefault(require("antd/es/switch"));

require("antd/es/checkbox/style");

var _checkbox = _interopRequireDefault(require("antd/es/checkbox"));

require("antd/es/input-number/style");

var _inputNumber = _interopRequireDefault(require("antd/es/input-number"));

require("antd/es/input/style");

var _input = _interopRequireDefault(require("antd/es/input"));

var _react = _interopRequireDefault(require("react"));

var _list = _interopRequireDefault(require("./list"));

var _map = _interopRequireDefault(require("./map"));

var _createWidget = require("../../createWidget");

var _imageInput = _interopRequireDefault(require("./imageInput"));

var _urlInput = _interopRequireDefault(require("./urlInput"));

var _html = _interopRequireDefault(require("./html"));

var _select = _interopRequireDefault(require("./select"));

var _checkboxes = _interopRequireDefault(require("./checkboxes"));

var _multiSelect = _interopRequireDefault(require("./multiSelect"));

var _radio = _interopRequireDefault(require("./radio"));

var _time = _interopRequireDefault(require("./time"));

var _date = _interopRequireDefault(require("./date"));

var _dateRange = _interopRequireDefault(require("./dateRange"));

var _timeRange = _interopRequireDefault(require("./timeRange"));

var _excluded = ["style"];

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var TreeSelect = _react.default.lazy(function () {
  return Promise.resolve().then(function () {
    return _interopRequireWildcard(require('antd/es/tree-select'));
  });
}); // const Cascader = React.lazy(() => import('antd/es/cascader'));


var color = _react.default.lazy(function () {
  return Promise.resolve().then(function () {
    return _interopRequireWildcard(require('./color'));
  });
});

var slider = _react.default.lazy(function () {
  return Promise.resolve().then(function () {
    return _interopRequireWildcard(require('./slider'));
  });
});

var upload = _react.default.lazy(function () {
  return Promise.resolve().then(function () {
    return _interopRequireWildcard(require('./upload'));
  });
});

var TextArea = _input.default.TextArea;
var FrNumber = (0, _createWidget.createWidget)(function (_ref) {
  var style = _ref.style;
  return {
    style: _objectSpread({
      width: '100%'
    }, style)
  };
})(_inputNumber.default);
var FrTextArea = (0, _createWidget.createWidget)(function (_ref2) {
  var autoSize = _ref2.autoSize;
  return {
    autoSize: autoSize ? autoSize : {
      minRows: 3
    }
  };
})(TextArea);

var FrTreeSelect = function FrTreeSelect(_ref3) {
  var style = _ref3.style,
      rest = _objectWithoutProperties(_ref3, _excluded);

  return /*#__PURE__*/_react.default.createElement(TreeSelect, _extends({
    style: _objectSpread({
      width: '100%'
    }, style)
  }, rest));
}; // const FrCascader = ({ style, ...rest }) => (
//   <Cascader style={{ width: '100%', ...style }} {...rest} />
// );


var widgets = {
  input: _input.default,
  checkbox: _checkbox.default,
  checkboxes: _checkboxes.default,
  // checkbox多选
  color: color,
  date: _date.default,
  time: _time.default,
  dateRange: _dateRange.default,
  timeRange: _timeRange.default,
  imageInput: _imageInput.default,
  url: _urlInput.default,
  list: _list.default,
  map: _map.default,
  multiSelect: _multiSelect.default,
  // 下拉多选
  number: FrNumber,
  radio: _radio.default,
  select: _select.default,
  slider: slider,
  // 带滚条的number
  switch: _switch.default,
  textarea: FrTextArea,
  upload: upload,
  html: _html.default,
  rate: _rate.default,
  treeSelect: FrTreeSelect // cascader: FrCascader,

};
exports.widgets = widgets;
var defaultWidgetNameList = Object.keys(widgets);
exports.defaultWidgetNameList = defaultWidgetNameList;